package kresli;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import platno.Platno;

public class Kresli extends Frame {

	private static final long serialVersionUID = 1L;

	Kresli(Platno pl){
       super.setTitle(getClass().getName());
	   pl.setSize(pl.x, pl.y);
	   this.add(pl, BorderLayout.CENTER);
	   addWindowListener(new WindowAdapter() {
	         public void windowClosing(WindowEvent e) {
	             System.exit(0);                             //<--- Zrusi cele okno typu Frame !!!
	         }
	   });
	}
	public static void main(String[] args) {

		Platno pl = new Platno(200, 200);
		Graphics gr = pl.getGraphics();
        Kresli kr = new Kresli(pl);
        kr.setVisible(true);
        
        gr.setColor(new Color(0, 0, 0));
        gr.drawLine(10, 10, 100, 100);
	}
}
